import request from '@/utils/request'
import { Subject } from './type'
const baseUrl = '/subject'

// 获取课程列表
export const reqSubjectTree = () =>
  request.get<any, ResponseData>(`${baseUrl}/tree`)
// 批量删除
export const reqBatchDelSubject = (subjectIds: string[]) =>
  request.post<any, ResponseData>(`${baseUrl}/batchDel`, subjectIds)

export const reqUpdateDropSubject = (subjects: Subject[]) =>
  request.post<any, ResponseData>(`${baseUrl}/updateDrop`, subjects)

export const reqDeleteSubject = (subjectId: string) =>
  request.delete<any, ResponseData>(`${baseUrl}/${subjectId}`)

export const reqAddSubject = (subject: Subject) =>
  request.post<any, ResponseData>(`${baseUrl}`, subject)

export const reqUpdateSubject = (subject: Subject) =>
  request.put<any, ResponseData>(`${baseUrl}`, subject)
